/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lestr.otaf.editeur;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.lestr.astenn.PluginsManager;

import org.openide.awt.ActionRegistration;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionID;
import org.openide.filesystems.FileObject;
import org.openide.loaders.DataObject;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle.Messages;
import org.openide.util.Utilities;

@ActionID(category = "Build",
          id = "org.netbeans.demo.project.ActionRUnContextuelle")
@ActionRegistration(displayName = "#CTL_ActionRUnContextuelle")
@ActionReferences({
    @ActionReference(path = "Loaders/text/otaf+xml/Actions", position = 110)
})
@Messages("CTL_ActionRUnContextuelle=Exécuter")
public final class ActionExecuterContextuelle implements ActionListener {


    private final DataObject context;


    public ActionExecuterContextuelle(DataObject context) {
        this.context = context;
    }


    public void actionPerformed(ActionEvent ev) {

        
        PluginsManager.getSingleton();
        FileObject proj = Utilities.actionsGlobalContext().lookup(FileObject.class);
        
        try {
            
            ActionExecuter.executer(new URL("file:///" + proj.getPath()), new File(proj.getParent().getPath()));

        } catch (MalformedURLException ex) {
            Exceptions.printStackTrace(ex);
        }
        
    }


}

